package cuda;
import org.antlr.runtime.ANTLRStringStream;
import org.antlr.runtime.CommonTokenStream;
import org.antlr.runtime.RecognitionException;
import org.antlr.runtime.TokenStream;
import org.antlr.runtime.tree.CommonTreeNodeStream;
import org.antlr.runtime.tree.Tree;



public class Test {
	static String  code = "";
	/**
	 * @param args
	 * @throws RecognitionException
	 */
	public static void addLine(String line) {
		code += line + "\r\n";
	}
	
	public static void main(String[] args) throws RecognitionException {
		
//		addLine("scalar x, x 3");  
	//	addLine("");  
//		addLine("v = 1:2:3"); 
	//	addLine("matrix m1[3][2]"); 
	//	addLine("matrix m2[3][3]");
	//	addLine("m1 = m2");
		//addLine("m1 = m1 * m2");


		CudaLexer cudaLexer = new CudaLexer(new ANTLRStringStream(code));
		TokenStream tokenStream = new CommonTokenStream(cudaLexer);
		CudaParser cudaParser = new CudaParser(tokenStream);
		CudaParser.program_return program = cudaParser.program();
		
		System.out.println("tree: \n "+((Tree)program.tree).toStringTree());
		
		CommonTreeNodeStream nodeStream = new CommonTreeNodeStream(program.tree);
		TreeWalker walker = new TreeWalker(nodeStream);
		System.out.println(walker.program().app);
		System.out.println("tree ok");
		
	}
}
